/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * TrainingBook
 * Copyright (C) Arnaud Duval 2010 <arnaud.duval@gmail.com>
 *
 * TrainingBook is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TrainingBook is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _X_Y_PLOT_AREA_HPP_
#define _X_Y_PLOT_AREA_HPP_

#include <gtkmm.h>
#include "rgb-color.hpp"

///@class XYPlotArea
///@brief Define a drawing area to plot a XY relation
class XYPlotArea: public Gtk::DrawingArea 
{
	public:
		///@brief Contructor
		XYPlotArea();
		///@brief Destructor
		virtual ~XYPlotArea();
		///@brief Set the X list
		void SetXList(std::list<double>);
		///@brief Set the Y list
		void SetYList(std::list<double>, unsigned int);
		///@brief Set X values range
		void SetXRange(double, double);
		///@brief Set Y values range
		void SetYRange(double, double, unsigned int);
		///@brief Clean the X list
		void ClearXList();
		///@brief Clean a given Y list
		void ClearYList(unsigned int);
		///@brief Draw the axis on a given Cairo context
		void DrawAxis(Cairo::RefPtr<Cairo::Context>);

	protected:
		///@brief Override default signal handler
		virtual bool on_expose_event(GdkEventExpose* event);

	private:
		///@brief Number of plots
		unsigned int nbPlot;
		///@brief List containing the X data
		std::list<double> xList;
		///@brief Array of lists containing the Y data
		std::list<double> *yList;
		///@brief X range
		double x_min, x_max;
		///@brief Arrays containing the Y ranges
		double *y_min, *y_max;
		///@brief Colors for the differents plots
		RGBcolor* colors;
		///@brief index of the plot to paint with coored trapezes
		unsigned int idx_to_fill;	

};

#endif // _X_Y_PLOT_AREA_HPP_
